
# String からクラス定義を取得するための拡張
#
# Author:: krdlab
#
class String
  def camelize(upcase_first_letter = true)
    if upcase_first_letter then
      return self.gsub(/\/(.?)/) { '::' + $1.upcase }.gsub(/(^|_)(.)/) { $2.upcase }
    else
      return self.first + self.camelize()[1..-1]
    end
  end
  def constantize
    return Object.module_eval("::#{self.camelize}")
  end
end

class Object
  def blank?
    # TODO rails のやつとは微妙に違う
    self.nil? or self.to_s.empty?
  end
end

